﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AgilePlannerDT.Data;

namespace AgilePlannerDT.Display.CustomWidgets
{
    /// <summary>
    /// Interaction logic for ColorChooser.xaml
    /// </summary>
    public partial class ColorChooser : UserControl
    {
        public delegate void ColorChosenEventHandler(Color color);
        public event ColorChosenEventHandler OnColorChosen;

        public ColorChooser()
        {
            InitializeComponent();

            whiteButton.Click +=new RoutedEventHandler(whiteButton_Click);
            redButton.Click +=new RoutedEventHandler(redButton_Click);
            pinkButton.Click +=new RoutedEventHandler(pinkButton_Click);
            blueButton.Click +=new RoutedEventHandler(blueButton_Click);
            greenButton.Click +=new RoutedEventHandler(greenButton_Click);
            yellowButton.Click +=new RoutedEventHandler(yellowButton_Click);
            peachButton.Click +=new RoutedEventHandler(peachButton_Click);
            grayButton.Click +=new RoutedEventHandler(grayButton_Click);
            aquaButton.Click +=new RoutedEventHandler(aquaButton_Click);
            khakiButton.Click +=new RoutedEventHandler(khakiButton_Click);
        }

        private void whiteButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.WHITE);
        }

        private void redButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.RED);
        }

        private void pinkButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.PINK);
        }

        private void blueButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.BLUE);
        }

        private void greenButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.GREEN);
        }

        private void yellowButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.YELLOW);
        }

        private void peachButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.PEACH);
        }

        private void grayButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.GRAY);
        }

        private void aquaButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.AQUA);
        }

        private void khakiButton_Click(object sender, RoutedEventArgs e)
        {
            ColorChosen(CardConstants.KHAKI);
        }

        private void ColorChosen(Color color)
        {
            if (OnColorChosen != null)
                OnColorChosen(color);
        }
    }
}
